package com.beiben.statistics.controller;

import com.beiben.statistics.service.IAbilityService;
import com.beiben.statistics.vo.AbillityDataVo;
import com.beiben.statistics.vo.NameValueVo;
import com.beiben.statistics.vo.RecordSearchParamVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 考试成绩统计看板Controller
 *
 * @author dulei
 * @date 2020-08-26
 */
@RestController
@RequestMapping("/statistics")
public class AbilityController {

    @Autowired
    private IAbilityService abilityService;


    /**
     * 查询所的考试成绩柱状图
     */
    @GetMapping("/ability/dept/suo")
    @ResponseBody
    public List<AbillityDataVo> selectAbilityDeptSuo(RecordSearchParamVo recordSearchParamVo, HttpServletRequest request, HttpServletResponse response){
        return abilityService.selectAbilityDeptSuo(recordSearchParamVo);
    }


    /**
     * 查询科室的考试成绩柱状图
     */
    @GetMapping("/ability/dept/shi")
    @ResponseBody
    public List<AbillityDataVo> selectAbilityDeptShi(RecordSearchParamVo recordSearchParamVo){
        return abilityService.selectAbilityDeptShi(recordSearchParamVo);
    }

    /**
     * 查询人员的考试成绩柱状图
     */
    @GetMapping("/ability/dept/people")
    @ResponseBody
    public List<AbillityDataVo> selectAbilityDeptPeople(RecordSearchParamVo recordSearchParamVo){
        return abilityService.selectAbilityDeptPeople(recordSearchParamVo);
    }

    /**
     * 查询所的考试成绩饼状图
     */
    @GetMapping("/ability/dept/suo/pie")
    @ResponseBody
    public List<NameValueVo> selectAbilityDeptSuoCompared(RecordSearchParamVo recordSearchParamVo){
        return abilityService.selectAbilityDeptSuoCompared(recordSearchParamVo);
    }

    /**
     * 查询室的考试成绩饼状图
     */
    @GetMapping("/ability/dept/shi/pie")
    @ResponseBody
    public List<NameValueVo> selectAbilityDeptShiCompared(RecordSearchParamVo recordSearchParamVo){
        return abilityService.selectAbilityDeptSuoCompared(recordSearchParamVo);
    }

    /**
     * 查询室下的人的考试成绩饼状图
     */
    @GetMapping("/ability/dept/people/pie")
    @ResponseBody
    public List<NameValueVo> selectAbilityDeptPeopleCompared(RecordSearchParamVo recordSearchParamVo){
        return abilityService.selectAbilityDeptSuoCompared(recordSearchParamVo);
    }

    /**
     * 查询所的考试实考与应考柱状图
     */
    @GetMapping("/ability/dept/suo/percent")
    @ResponseBody
    public List<AbillityDataVo> selectPercentDeptSuo(RecordSearchParamVo recordSearchParamVo){
        return abilityService.selectPercentDeptSuo(recordSearchParamVo);
    }

    /**
     * 查询科室的考试实考与应考柱状图
     */
    @GetMapping("/ability/dept/shi/percent")
    @ResponseBody
    public List<AbillityDataVo> selectPercentDeptShi(RecordSearchParamVo recordSearchParamVo){
        return abilityService.selectPercentDeptShi(recordSearchParamVo);
    }

    /**
     * 查询人员的考试成绩及考试内容
     */
    @GetMapping("/ability/dept/people/percent")
    @ResponseBody
    public List<AbillityDataVo> selectPercentDeptPeople(RecordSearchParamVo recordSearchParamVo){
        return abilityService.selectPercentDeptPeople(recordSearchParamVo);
    }


}
